<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" th:with="title='保存文章',active='publish'">
<link th:href="@{/admin1/plugins/tagsinput/jquery.tagsinput.css}" rel="stylesheet"/>
<link th:href="@{/admin1/plugins/select2.dist.css/select2-bootstrap.css}" rel="stylesheet"/>
<link th:href="@{/admin1/plugins/toggles/toggles.css}" rel="stylesheet"/>

<link href="//cdn.bootcss.com/multi-select/0.9.12/css/multi-select.css" rel="stylesheet"/>
<link href="//cdn.bootcss.com/select2/3.4.8/select2.min.css" rel="stylesheet"/>
<link th:href="@{/admin1/plugins/md/css/style.css}" rel="stylesheet"/>
<!-- editor.md -->
<link th:href="@{/admin1/editormd/css/editormd.css}" rel="stylesheet"/>
<style>
    #tags_tagsinput {
        background-color: #fafafa;
        border: 1px solid #eeeeee;
    }

    #tags_addTag input {
        width: 100%;
    }

    #tags_addTag {
        margin-top: -5px;
    }
</style>
<body class="fixed-left">
<div id="wrapper">

    <div class="content-page">
        <div class="content">
            <div class="container">
                <div class="row">
                    <div class="col-sm-12">
                        <h4 class="page-title">

                            <block >
                                发布文章
                            </block>
                        </h4>
                    </div>
                    <div class="col-md-12">
                        <form id="articleForm" role="form" novalidate="novalidate">
                            <div class="form-group col-md-6" style="padding: 0 10px 0 0;">
                                <input type="text" class="form-control" placeholder="请输入文章标题（必须）" name="title"
                                       required="required"
                                       aria-required="true"
                                       value="${contents!=null and contents.title!=null }?${contents.title}: ''"/>
                            </div>

                            <div class="form-group col-md-6" style="padding: 0 0 0 10px;">
                                <select id="multiple-type" class="select2 form-control"
                                        data-placeholder="请选择文章类型..">
                                    <block >
                                        <option value="post" selected="selected">默认博文</option>
                                        <option value="photo" >作品</option>
                                    </block>
                                    <block >
                                        <option value="post" selected="true">默认博文</option>
                                        <option value="photo" selected="true" >作品</option>
                                    </block>
                                </select>
                            </div>


                                <div class="form-group col-md-6" style="padding: 0 10px 0 0;">
                                    <!-- 如果是作品类，那么暂时不允许使用标签 -->
                                    <input name="tags" id="tags"  type="text" class="form-control" placeholder="请填写文章标签"
                                           value="文章标签"/>
                                </div>
                                <div class="form-group col-md-6" >
                                    <select id="multiple-sel"   class="select2 form-control" multiple="multiple"
                                            data-placeholder="请选择分类...">
                                        <block >
                                            <option value="默认分类" selected="selected">默认分类</option>
                                        </block>
                                        <tblock >
                                            <block >
                                                <option value="${c.name}" text="${c.name}"
                                                        selected=""></option>
                                            </block>
                                        </tblock>
                                    </select>
                                </div>

                            <div class="clearfix"></div>
                            <div id="my-editormd" >
                                <textarea id="my-text" name="my-text" style="display:none;" class="markdown-textarea"
                                          ></textarea>
                                <!-- 注意：name属性的值-->
                                <textarea id="text" name="text" style="display:none;" ></textarea>
                            </div>


                            <div class="form-group col-md-3 col-sm-4" id="comment-div">
                                <label class="col-sm-4">开启评论</label>
                                <div class="col-sm-8">
                                    <div class="toggle toggle-success allow-true"
                                         ></div>
                                </div>
                            </div>

                            <div class="clearfix"></div>

                            <div class="text-right">
                                <a class="btn btn-default waves-effect waves-light" th:href="@{/admin/article}">返回列表</a>
                                <button type="button" class="btn btn-primary waves-effect waves-light"
                                     >
                                    保存文章
                                </button>
                                <button type="button" class="btn btn-warning waves-effect waves-light"
                                        >
                                    存为草稿
                                </button>
                            </div>
                        </form>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(function() {
        editormd("my-editormd", {//注意1：这里的就是上面的DIV的id属性值
            width   : "90%",
            height  : 640,
            syncScrolling : "single",
            path    : "/admin1/editormd/lib/",//注意2：你的路径
            saveHTMLToTextarea : true,//注意3：这个配置，方便post提交表单
            /**上传图片相关配置如下*/
            imageUpload: true,
            imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"], //图片上传格式
            imageUploadURL: "/admin1/attach/uploadfile",
            onload: function (obj) { //上传成功之后的回调
            }
        });
    });
</script>
<script th:src="@{/admin1/plugins/tagsinput/jquery.tagsinput.min.js}"></script>
<!--<script th:src="@{/admin1/plugins/jquery-multi-select/jquery.quicksearch.js}"></script>-->

<!-- editor.md -->
<script th:src="@{/admin1/editormd/src/editormd.js}"></script>


<script th:src="@{//cdn.bootcss.com/multi-select/0.9.12/js/jquery.multi-select.min.js}"></script>
<script th:src="@{//cdn.bootcss.com/select2/3.4.8/select2.min.js}"></script>
<script th:src="@{//cdn.bootcss.com/jquery-toggles/2.0.4/toggles.min.js}"></script>
<!--<script th:src="@{/admin1/js/article.js}"></script>-->
</body>
</html>